<?
$id=$_GET["id"];

$db=mysql_connect("localhost", "coMexpert", "");
mysql_select_db("coMexpert", $db);

mysql_query("update abonneEMailing set abonne=0, modification=curdate(), modificateur=user() where id=\"$id\"", $db);

$result=mysql_query("select mail, societe from abonneEMailing where id=\"$id\"", $db);
$row=mysql_fetch_array($result);
if($row)
{
	$entete="MIME-Version: 1.0\n";
	$entete.="Content-Type: text/html; charset=utf-8\n";
	$entete.="From: news letters <info@alpes-ressources.dom>\n";

	$message="<h1>Désabonement de la news letter</h1>";
	$message.="<hr>";
	$message.="L'email <u>".$row["mail"]."</u> de la société <b>".$row["societe"]."</b> ne receverra plus la news letter";

	mail("corentin@alpes-ressources.dom", "Désabonnement de la news letter", $message, $entete);
}

?>
<html>
	<body>
		<script language="javascript">
			document.location="http://www.alpes-ressources.com/campagne/desabonnement.htm";
		</script>
	</body>
</html>
<?
mysql_close($db);

?>
